package priv.menguer.visitor.service.impl;

import priv.menguer.visitor.service.ComputerPart;
import priv.menguer.visitor.service.ComputerPartVisitor;

/**
 * @Title Computer.java
 * @description TODO
 * @time 2018年10月26日 上午11:51:11
 * @author menguer@126.com
 * @version 1.0
 */
public class Computer implements ComputerPart {

	ComputerPart[] parts;

	public Computer() {
		parts = new ComputerPart[] { new Mouse(), new Keyboard(), new Monitor() };
	}

	@Override
	public void accept(ComputerPartVisitor computerPartVisitor) {
		for (int i = 0; i < parts.length; i++) {
			parts[i].accept(computerPartVisitor);
		}
		computerPartVisitor.visit(this);
	}
}
